package outerclass.sample_demo;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025/5/11
 * Time: 14:05
 */

public class SampleOuterClass {
    public String outer1;
    public String publicNumber = "outerPublicNumber";
    public SampleOuterClass(String outer1) {
        this.outer1 = outer1;
    }
    public void outer2() {
        System.out.println("实例外部类");
    }
    public class SampleInnerClass {
        public String inner1;
        public String publicNumber = "innerPublicNumber";
        public SampleInnerClass(String inner1) {
            this.inner1 = inner1;
        }
        public void inner2() {
            System.out.println("实例内部类");
            System.out.println(this.inner1);
            System.out.println(outer1);
            System.out.println(this.publicNumber);
            System.out.println(SampleOuterClass.this.publicNumber);
            outer2();
        }
    }
    public SampleInnerClass sampleInnerClass =
            new SampleInnerClass("inner");
    public void outer3() {
        System.out.println(sampleInnerClass.inner1);
    }
}
